import CommentItemFragmentInjectable from "@vanilla/injectables/CommentItemFragment";
import { IFragmentPreviewData } from "@library/utility/fragmentsRegistry";
import { blessStringAsSanitizedHtml } from "@vanilla/dom-utils";
import { uuidv4 } from "@vanilla/utils";

const exampleComment = {
    commentID: 999999,
    parentRecordType: "discussion",
    parentRecordID: 999999,
    categoryID: 1,
    insertUser: {
        name: "Joe Walsh",
        dateLastActive: "2016-07-25 17:51:15",
        photoUrl: "https://user-images.githubusercontent.com/1770056/74098133-6f625100-4ae2-11ea-8a9d-908d70030647.png",
        label: "SuperModerator",
        title: "Manager",
        banned: 0,
        roles: [
            {
                roleID: 0,
                name: "Moderator",
            },
        ],
        private: false,
        userID: 13,
    },
    insertUserID: 13,
    dateInserted: "2020-10-06T15:30:44+00:00",
    dateUpdated: "2020-10-06T15:30:44+00:00",
    score: 999,
    url: "https://vanillaforums.com/discussion/comment/999999#Comment_999999",
    attributes: {},
    body: blessStringAsSanitizedHtml(
        "This content is generated by users on the site. You can't update it here. This content is added by member of your community and can be updated by them. Other members could react to this content with the reactions you have configured. They can also report this content if they find it inappropriate.",
    ),
    name: "This content is generated by users on the site. You can't update it here.",
    reactions: [
        {
            tagID: 1,
            urlcode: "Promote",
            name: "Promote",
            class: "Positive",
            hasReacted: false,
            reactionValue: 5,
            count: 0,
        },
        {
            tagID: 2,
            urlcode: "Disagree",
            name: "Disagree",
            class: "Negative",
            hasReacted: false,
            reactionValue: 0,
            count: 3,
        },
        {
            tagID: 3,
            urlcode: "Agree",
            name: "Agree",
            class: "Positive",
            hasReacted: true,
            reactionValue: 1,
            count: 2,
        },
        {
            tagID: 4,
            urlcode: "Like",
            name: "Like",
            class: "Positive",
            hasReacted: false,
            reactionValue: 1,
            count: 0,
        },
        {
            tagID: 5,
            urlcode: "LOL",
            name: "LOL",
            class: "Positive",
            hasReacted: false,
            reactionValue: 0,
            count: 7,
        },
    ],
};

const previewData: Array<IFragmentPreviewData<CommentItemFragmentInjectable.Props>> = [
    {
        previewDataUUID: uuidv4(),
        name: "As member",
        description: "An example of a comment item as viewed by a member of the community.",
        data: {
            comment: exampleComment,
            categoryID: 1,
            isHighlighted: false,
            warnings: null,
            showOPTag: false,
            isEditing: false,
        },
    },
    {
        previewDataUUID: uuidv4(),
        name: "As an original poster",
        description: "An example of a comment item displaying the original poster tag.",
        data: {
            comment: exampleComment,
            categoryID: 1,
            isHighlighted: false,
            warnings: null,
            showOPTag: true,
            isEditing: false,
        },
    },
    {
        previewDataUUID: uuidv4(),
        name: "From comment permalink",
        description: "An example of a comment item which is highlighted.",
        data: {
            comment: exampleComment,
            categoryID: 1,
            isHighlighted: true,
            warnings: null,
            showOPTag: false,
            isEditing: false,
        },
    },
    {
        previewDataUUID: uuidv4(),
        name: "By ignored user",
        description: "An example of a comment from someone who has been ignored.",
        data: {
            comment: exampleComment,
            categoryID: 1,
            isHighlighted: false,
            warnings: null,
            showOPTag: false,
            isEditing: false,
            isHidden: true,
        },
        previewProps: {
            isIgnoredUser: true,
        },
    },
    {
        previewDataUUID: uuidv4(),
        name: "By a warned user",
        description: "An example of a comment with a warning.",
        data: {
            comment: exampleComment,
            categoryID: 1,
            isHighlighted: false,
            warnings: {
                userNoteID: 1,
                type: "warning",
                body: "<p>Warning body content will go here</p>",
                format: "rich2",
                user: {
                    ...exampleComment.insertUser,
                },
                insertUser: {
                    userID: 1,
                    name: "System",
                    url: "",
                    photoUrl: "",
                    dateLastActive: "2025-05-05T19:57:16+00:00",
                    banned: 0,
                    punished: 0,
                    private: false,
                },
                recordType: "comment",
                recordID: 1,
                dateInserted: "2025-05-05T19:57:58+00:00",
                warningType: {
                    warningTypeID: 1,
                    name: "Notice",
                    points: 0,
                    expireNumber: 0,
                    expireType: "hours",
                    description: "0 points ",
                },
                rule: {
                    ruleID: 2,
                    name: "Be Respectful",
                },
                points: 0,
                moderatorNote: "This is the private note to other moderators.",
                conversationID: 12,
            },
            showOPTag: false,
            isEditing: false,
            isHidden: false,
        },
    },
    {
        previewDataUUID: uuidv4(),
        name: "With attachements",
        description: "An example of a comment with attachments.",
        data: {
            comment: {
                ...exampleComment,
                attachments: [
                    {
                        attachmentID: 1,
                        attachmentType: "VanillaEscalation",
                        recordType: "comment",
                        recordID: "1",
                        sourceUrl: "https://higherlogic.com",
                        dateInserted: "2025-05-05T19:57:58+00:00",
                        dateUpdated: "2025-05-05T19:57:58+00:00",
                        state: "In Progress",
                        status: "Open",
                        metadata: [],
                    },
                ],
            },
            categoryID: 1,
            isHighlighted: false,
            warnings: null,
            showOPTag: false,
            isEditing: false,
            isHidden: false,
        },
    },
    {
        previewDataUUID: uuidv4(),
        name: "As editing",
        description: "An example of a comment with is being edited.",
        data: {
            comment: exampleComment,
            categoryID: 1,
            isHighlighted: false,
            warnings: null,
            showOPTag: false,
            isEditing: true,
            isHidden: false,
        },
    },
    {
        previewDataUUID: uuidv4(),
        name: "With moderation checkboxes",
        description: "An example of a comment with checkboxes for bulk moderation actions.",
        data: {
            comment: exampleComment,
            categoryID: 1,
            isHighlighted: false,
            warnings: null,
            showOPTag: false,
            isEditing: false,
            isHidden: false,
        },
        previewProps: {
            isCheckboxesVisible: true,
        },
    },
];
export default previewData;
